package severlet;

import bean.Fee;
import dao.FeeDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet(name = "StudentFeeServlet", value = "/StudentFeeServlet")
public class StudentFeeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            request.setCharacterEncoding("utf-8");
            response.setCharacterEncoding("utf-8");

            //用来查询学生端的
//        根据宿舍号查询费用清空

        //登录成功获取宿舍号
        String dormitoryid= (String) request.getSession().getAttribute("dormitoryid");
        //查询完毕之后存入session返回网页
        FeeDao feeDao=new FeeDao();
        ArrayList<Fee> studentFeeList = feeDao.getfeeinfoByDormitoruid(dormitoryid);
        request.getSession().setAttribute("studentFee",studentFeeList);
        request.getRequestDispatcher("student_fee.jsp").forward(request,response);

    }
}
